/*
 * Copyright (c) 2022 上海市政工程设计研究总院(集团)有限公司 All Rights Reserved.
 */
package com.smedi.ismedi.organization.core.port.adapter.convert;

import com.smedi.ismedi.constructionproject.api.dto.request.ProjectAssignmentListQueryRequest;
import com.smedi.ismedi.constructionproject.api.dto.request.ProjectListQueryRequest;
import com.smedi.ismedi.notification.api.dto.request.SendSmsRequest;
import com.smedi.ismedi.organization.api.dto.request.*;
import com.smedi.ismedi.organization.api.dto.response.SendMessageByJobRespose;
import com.smedi.ismedi.organization.api.dto.response.SendMessageByRoleRespose;
import com.smedi.ismedi.organization.api.dto.response.resp.AllOrganizationResp;
import com.smedi.ismedi.organization.api.dto.response.resp.OrganizationResp;
import com.smedi.ismedi.organization.api.dto.response.resp.ProjectOrganizationResp;
import com.smedi.ismedi.organization.core.application.command.*;
import com.smedi.ismedi.organization.core.application.query.vo.AllOrganizationVo;
import com.smedi.ismedi.organization.core.domain.aggregatemodel.SendMessage;
import com.smedi.ismedi.organization.core.domain.aggregatemodel.dto.OrganizationAssignmentQuery;
import com.smedi.ismedi.organization.core.domain.aggregatemodel.dto.PersonQuery;
import com.smedi.ismedi.organization.core.domain.aggregatemodel.model.*;
import com.smedi.ismedi.organization.core.port.adapter.persistence.dto.ProjectAssignmentQuery;
import com.smedi.ismedi.organization.core.port.adapter.persistence.dto.ProjectQuery;
import com.smedi.ismedi.organization.core.port.adapter.persistence.model.HrOrganizationEntity;
import com.smedi.ismedi.organization.core.port.adapter.persistence.model.ProjectOrganizationEntity;
import com.smedi.ismedi.personnel.api.dto.request.OrganizationAssignmentListQueryRequest;
import com.smedi.ismedi.personnel.api.dto.request.PersonListQueryRequest;
import com.smedi.ismedi.personnel.api.dto.response.resp.OrganizationAssignmentResp;
import com.smedi.ismedi.personnel.api.dto.response.resp.PersonResp;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.ReportingPolicy;

import java.util.List;

/**
 * 维修内容 Infrastructure Converter
 *
 * @author 15428
 * &#064;date  2022-06-07 15:22:03
 * @since 0.0.1
 */
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface AdapterConverter {
    PersonListQueryRequest personQueryToPersonListQueryRequest(PersonQuery personQuery);

    List<Person> personRespToPerson(List<PersonResp> personResps);

    @Mapping(source = "lastName",target = "name")
    Person personRespToPerson(PersonResp personResp);

    Organization hrOrganizationEntityToOrganization(HrOrganizationEntity hrOrganizationEntity);

    List<Organization> hrOrganizationEntityToOrganization(List<HrOrganizationEntity> hrOrganizationEntities);

    OrganizationListQueryCommand organizationListQueryRequestToOrganizationListQueryCommand(OrganizationListQueryRequest organizationListQueryRequest);

    List<OrganizationResp> organizationsToOrganizationResp(List<Organization> organizations);

    OrganizationResp organizationsToOrganizationResp(Organization organization);

    ProjectOrganizationListQueryCommand organizationListQueryRequestToProjectOrganizationListQueryCommand(ProjectOrganizationListQueryRequest projectOrganizationListQueryRequest);

    List<ProjectOrganizationResp> projectOrganizationsToProjectOrganizationResp(List<ProjectOrganizationModel> organizations);

    List<ProjectOrganizationModel> projectOrganizationEntityToProjectOrganization(List<ProjectOrganizationEntity> projectOrganizationEntities);

    OrganizationOneQueryCommand organizationOneQueryRequestToOrganizationOneQueryCommand(OrganizationOneQueryRequest organizationOneQueryRequest);

    ProjectAssignmentListQueryRequest projectAssignmentQueryToProjectAssignmentListQueryRequest(ProjectAssignmentQuery projectAssignmentQuery);

    ProjectListQueryRequest projectQueryToProjectListQueryRequest(ProjectQuery projectQuery);

    List<AllOrganizationResp> allOrganizationVoToAllOrganizationResp(List<AllOrganizationVo> allOrganizationVos);

    List<DingOrg> hrOrganizationEntityToDingOrgs(List<HrOrganizationEntity> hrOrganizationEntityList);

    @Mapping(source = "mobiles", target = "receivers")
    SendSmsRequest messageSendCommandToSendSmsRequest(MessageSendCommand messageSendCommand);

    OrganizationAssignmentListQueryRequest organizationAssignmentQueryToOrganizationAssignmentListQueryRequest(OrganizationAssignmentQuery organizationAssignmentQuery);

    List<OrganizationAssignment> organizationAssignmentRespToOrganizationAssignment(List<OrganizationAssignmentResp> organizationAssignmentResp);

    SendMessageByRoleCommand sendMessageByRoleRequestToSendMessageByRoleCommand(SendMessageByRoleRequest sendMessageByRoleRequest);

    SendMessageByJobCommand sendMessageByJobRequestToSendMessageByJobCommand(SendMessageByJobRequest sendMessageByJobRequest);


    List<SendMessageByJobRespose> sendMessagesToSendMessageByJobRespose(List<SendMessage> sendMessages);
    SendMessageByRoleRespose sendMessagesToSendMessageByRoleRespose(SendMessage sendMessage);
}
